<template>
  <div>
    <div class="newAdd">
      <el-button
        style="float: left"
        type="primary"
        size="small"
        icon="el-icon-plus"
        @click="dialogVisible = true"
        >新 增</el-button
      >
      <el-button size="small" style="float: right" type="primary"
        >搜索</el-button
      >
      <el-input
        size="small"
        style="width: 200px; float: right"
        v-model="ruleForm.userInfo"
        placeholder="请输入"
      ></el-input>
    </div>
    <el-dialog
      class="dialog"
      title="更新用户"
      :visible.sync="dialogVisible"
      width="700px"
    >
      <div>
        <el-form ref="form" :model="ruleForm" :rules="rules" label-width="auto">
          <el-form-item label="姓名" prop="name">
            <el-input v-model="ruleForm.name"></el-input>
          </el-form-item>
          <el-form-item label="年龄" prop="age">
            <el-input v-model="ruleForm.age"></el-input>
          </el-form-item>
          <el-form-item label="性别">
            <el-select v-model="ruleForm.sex" label="性别">
              <el-option value="male" label="男"></el-option>
              <el-option value="female" label="女 "></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="出生日期">
            <div class="block">
              <el-date-picker
                v-model="ruleForm.value1"
                type="datetime"
                placeholder="选择日期时间"
              >
              </el-date-picker>
            </div>
          </el-form-item>
          <el-form-item label="地址">
            <el-input v-model="ruleForm.address"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div class="footer" slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
// import UserForm from "@/components/UserForm.vue";
export default {
  name: "Goods",
  data() {
    return {
      dialogVisible: false,
      ruleForm: {
        name: "",
        age: "",
        sex: "male",
        value1: "",
        userInfo: "",
        address: "",
      },
      rules: {
        name: [{ required: true, message: "请输入姓名！", trigger: "blur" }],
        age: [
          {
            pattern: /^\d{0,3}$/,
            message: "请输入正确年龄！",
            trigger: "blur",
          },
          { required: true, message: "请输入年龄！", trigger: "blur" },
        ],
      },
    };
  },
  methods: {},
};
</script>

<style scoped lang='less'>
i {
  color: red;
  font-size: 30px;
}
.newAdd {
  margin-top: 10px;
}
.dialog {
  .el-form {
    display: flex;
    flex-wrap: wrap;
    .el-form-item {
      width: 300px;
    }
  }
  .footer {
    margin-top: -40px;
  }
}
</style>